import { request } from './request'

export function createActvity(data) {
    return request({
      url:'/users/activities/create',
      method:'post',
      data:data
    })
}

export function myActivity(data) {
  return request({
    url:'/users/activities/myActivity',
    method:'post',
    data:data
  })
}

export function selectById(data) {
  return request({
    url:`/users/activities/activityDetail/${data}`
  })
}

// 删除所发起的活动
export function  deleteActivity(data) {
  const {aid ,status} = data
  return request({
    url:`/users/activities/cancelActivity?aid=${aid}&status=${status}`,
    method:'delete'
  })
}

// 获取活动申请者列表
export function applyList(data) {
  const {aid,pageNum} = data
  return request({
    url:`/users/activityApply/getList?aid=${aid}&pageNum=${pageNum}`,
    method:'get'
  })
}

// 发布活动成果
export function outComes(data) {
  return request({
    url:'/users/activityOutcomes/publish',
    method:'post',
    data:data
  })
}

// 获取可参加的活动的列表
export function enableActivity(data) {
   return request({
     url:'/users/activities/enableActivity',
     method:'post',
     data:data
   })
}

// 获取用户可参与的活动详情
export function  getCanActivityDetail(data) {
  return request({
    url:`/users/activities/canActivityDetail/${data}`
  })
}

// 参与可参与的活动
export function joinActivity(data) {
  return request({
    url:`/users/activityApply/joinActivity/${data}`,
    method:'post'
  })
}

// 取消已参与的活动
export function cancelJoin(data) {
  return request({
    url:`/users/activityApply/deleteJoinActivity/${data}`,
    method:'delete'
  })
}

// 获取我报名的活动
export function getMyList(data) {
  return request({
    url:'/users/activities/alreadyJoin',
    method:'post',
    data:data
  })
}

// 获取活动成果列表
export function getOutcomesList(data) {
  return request({
    url:'/users/activityOutcomes/getList',
    method:'post',
    data:data
  })
}

// 获取活动成果详情
export function outcomesDetail(data) {
  return request({
    url:`/users/activityOutcomes/detail/${data}`
  })
}